package offer;

public class offer11 {
    public static void main(String[] args) {
        int[] array = new int[]{2,2,2,0,1};
        Solution sol = new Solution();
        System.out.println(sol.minArray(array)); 

    }
}

class Solution {
    public int minArray(int[] numbers) {
        if(numbers == null || numbers.length == 0) return -1;

        for(int i = numbers.length-2; i >= 0; i--) {
            if(numbers[i+1] < numbers[i]) return numbers[i+1];
        }
        return -1;
    }
}


